package com.weixing.mall.provider.controller.admin;


import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.core.support.auth.SysAuth;
import com.weixing.mall.core.support.auth.SysInfo;
import com.weixing.mall.provider.model.dto.GoodsPointDto;
import com.weixing.mall.provider.model.enums.GoodsPointStatusEnum;
import com.weixing.mall.provider.model.query.GoodsPointQuery;
import com.weixing.mall.provider.service.IGoodsPointService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "后端:积分商品",tags = "后端:积分商品")
@RestController
@RequestMapping("/goodsPoint")
public class GoodsPointController extends BaseController {
    @Autowired
    private IGoodsPointService goodsPointService;

    /**
     * 获取积分商品列表
     */
    @ApiOperation(value = "获取积分商品列表")
    @PostMapping("selectList")
    public Result selectGoodsPoint(@RequestBody GoodsPointQuery goodsPointQuery){
        return ResultUtil.success(goodsPointService.selectGoodsPointList(initMPage(),goodsPointQuery));
    }

    /**
     * 添加或修改积分商品信息
     */
    @ApiOperation(value = "添加或修改积分商品信息")
    @PostMapping("saveOrUpdate")
    public Result saveOrUpdate(@SysInfo SysAuth auth, @RequestBody GoodsPointDto goodsPointDto){
        return goodsPointService.saveOrUpdate(goodsPointDto,auth.getUid());
    }

}
